package com.nervenets.general;


import org.apache.commons.lang.ArrayUtils;

/**
 * Created by joe on 17-3-16.
 */
@SuppressWarnings("ALL")
public final class Global {
    public static final String[] defaultIgnoreProperties(String... mores) {
        final String[] bases = {"id", "version", "deleted", "createTime", "createBy"};
        return (String[]) ArrayUtils.addAll(bases, mores);
    }

    public static final class TokenIllegalType {
        public static final int VERIFY = 401;
        public static final int EXPIRED = 402;
        public static final int NONE_USER = 403;
        public static final int NONE_TOKEN = 404;
        public static final int ERROR = 405;
        public static final int MISS = 406;
        public static final int SERVICE_FAILURE = 407;
    }

    public static final class RegExp {
        public static final String MOBILE = "^0{0,1}(1[0-9][0-9])[0-9]{8}$";
        public static final String EMAIL = "^\\s*\\w+(?:\\.{0,1}[\\w-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\\.[a-zA-Z]+\\s*$";
    }

    public static final class Constants {
        public static final String CACHE_KEY = "$DOMAIN$";
        public static final String TREES_CACHE_KEY = "$TREES$";
        public static final String REDIS_USER_WEALTH_LOCK = "wealth(%s)";
        public static final String MOBILE_VALIDATION_CODE = "mvc(%s)";
        public static final String SERVICE_TIME_COUNT_KEY = "stck(%s-%s)";
        public static final String SESSION_USER = "$SESSION_USER$";
        public static final String SESSION_ENV = "$SESSION_ENV$";
        public static final String SESSION_LOCK_KEYS = "$SESSION_LOCK_KEYS$";
        public static final String TOKEN_KEY = "User-Token";
        public static final String PLATFORM_KEY = "User-Platform";
        public static final String SOURCE_ID_KEY = "User-SourceId";
        public static final String FILE_UPLOAD_PROGRESS_KEY = "FileUploadProgress";
        public static final String RATE_LIMITER_KEY = "RateLimiter";
    }
}
